<!DOCTYPE HTML>
<html lang="en">
<head>
    <title>订单详情</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- jquery -->
    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <!-- bootstrap -->
    <link rel="stylesheet" type="text/css" href="../../bootstrap/css/bootstrap.min.css" />
    <script type="text/javascript" src="../../bootstrap/js/bootstrap.min.js"></script>
    <!-- layer -->
    <script type="text/javascript" src="../../layer/layer.js"></script>
    <!-- common.js -->
    <script type="text/javascript" src="../../js/common.js"></script>
</head>
<body>
<div class="panel panel-default">
    <div class="panel-heading">秒杀订单详情</div>
    <table class="table" id="order">
        <tr>
            <td>商品名称</td>
            <td id="goodsName" colspan="3"></td>
        </tr>
        <tr>
            <td>商品图片</td>
            <td colspan="2"><img id="goodsImg" src="" width="200" height="200"  alt="商品图片"/></td>
        </tr>
        <tr>
            <td>订单价格</td>
            <td colspan="2" id="orderPrice"></td>
        </tr>
        <tr>
            <td>下单时间</td>
            <td id="orderTime" colspan="2"></td>
        </tr>
        <tr>
            <td>订单状态</td>
            <td >
                <span id="orderStatus">未支付</span>
                <!--<span if="order.status eq 1">待发货</span>-->
                <!--<span if="order.status eq 2">已发货</span>-->
                <!--<span if="order.status eq 3">已收货</span>-->
                <!--<span if="order.status eq 4">已退款</span>-->
                <!--<span if="order.status eq 5">已完成</span>-->
            </td>
            <td>
                <button class="btn btn-primary btn-block" type="submit" id="payButton">立即支付</button>
            </td>
        </tr>
        <tr>
            <td>收货人</td>
            <td colspan="2">XXX  18012345678</td>
        </tr>
        <tr>
            <td>收货地址</td>
            <td colspan="2">上海市浦东区世纪大道</td>
        </tr>
    </table>
</div>
<script>
    $(function () {
        // 页面加载完毕后执行
        getOrderDetail();
    });

    function getOrderDetail() {
        //获取orderId
        let orderId = g_getQueryString('orderId');
        var od;
        $.ajax({
            url:'/order/detail',
            type: 'GET',
            data:{
                orderId: orderId
            },
            success(data){
                console.log(data);
                if(data.code === 200){
                    // 获取返回的对象
                    console.log(data.objects);
                    let orderDetail = data.objects;
                    od = orderDetail;
                    $("#goodsName").text(orderDetail.goodsName);
                    $("#goodsImg").attr('src',orderDetail.goodsImg);
                    $("#orderPrice").text(orderDetail.goodsPrice);
                    $("#orderTime").text(new Date(orderDetail.createDate).format('yyyy-MM-dd HH:mm:ss'));
                    let status = orderDetail.status;
                    // switch (status) {
                    //     // case ''
                    // }
                    // $("#")
                    // $("#")

                }else {
                    layer.msg(data.message);
                }
            },
            error(data){
                layer.msg(data.message);
            }

        })
    }
</script>
</body>
</html>